home *** CD-ROM | disk | FTP | other *** search
/ Computer Inter@ctive 17 / Computer Interactive cdrom 17 - gen 99.iso / ZDNETIT / CONTENT / SMTPCEMS.ZIP / STAT.C < prev    next >
Encoding:
C/C++ Source or Header  |  1998-11-15  |  1.0 KB  |  42 lines

  1. /*
  2. **  STAT.C [edit EMAIL.H before compiling]
  3. **
  4. **  This (console mode) program dislays the number 
  5. **  of email messages waiting on the SMTP server.
  6. */
  7.  
  8. #include <windows.h>
  9. #include <stdio.h>
  10. #include "see.h"
  11.  
  12. #include "email.h"
  13.  
  14. static char Buffer[512];
  15.  
  16. void ErrorExit(int Code)
  17. {seeErrorText(Code,(LPSTR)Buffer,512);
  18.  printf("SEE Error %d: %s\n", Code, Buffer);
  19.  exit(1);
  20. }
  21.  
  22. void main(void)
  23. {int Code; 
  24.  /* define diagnostics log file */
  25.  ///seeStringParam(SEE_LOG_FILE, (LPSTR)"stat.log"); 
  26.  /* connect to POP3 server */
  27.  puts("Connecting...");
  28.  Code = seePop3Connect(
  29.     (LPSTR)POP3_HOST_NAME,                   /* POP3 server */
  30.     (LPSTR)POP3_USER_NAME,                   /* user */ 
  31.     (LPSTR)POP3_PASSWORD);                   /* Password */
  32.  if(Code<0) ErrorExit(Code); 
  33.  /* get # messages waiting  */
  34.  puts("Getting message status...");
  35.  Code = seeGetEmailCount();                   
  36.  if(Code<0) ErrorExit(Code); 
  37.  printf("%d messages waiting\n", Code);
  38.  seeClose();
  39. } /* end main */
  40.  
  41.  
  42.